import { Client, Account, Avatars, Databases } from 'appwrite';

// Initialize Appwrite client
const client = new Client();

client
  .setEndpoint(import.meta.env.VITE_APPWRITE_ENDPOINT)
  .setProject(import.meta.env.VITE_APPWRITE_PROJECT_ID || '');

// Initialize services
export const account = new Account(client);
export const avatars = new Avatars(client);
export const databases = new Databases(client);

export { client };

// Database and Collection IDs
export const DATABASE_ID = import.meta.env.VITE_APPWRITE_DATABASE_ID || 'kernelproxy';
export const COLLECTIONS = {
  TICKETS: 'tickets',
  TICKET_MESSAGES: 'ticket_messages',
} as const;

// OAuth Provider URLs
export const OAuthProviders = {
  google: 'google',
  github: 'github',
} as const;

export type OAuthProvider = typeof OAuthProviders[keyof typeof OAuthProviders];
